//
//  ZDContactUsBViewController.m
//  ZDB
//
//  Created by Kk on 2020/3/31.
//  Copyright © 2020 ZDB. All rights reserved.
//

#import "ZDContactUsBViewController.h"
#import "ZDBContactUsListVC.h"
@interface ZDContactUsBViewController ()

@end

@implementation ZDContactUsBViewController
- (void)axcBaseClickBaseRightImageBtn:(UIButton *)sender
{
    [self.navigationController pushViewController:[ZDBContactUsListVC new] animated:YES];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [self axcBaseClickBaseRightTitleStr:@"联系列表"];
    WeakSelf
    [_subimtBtn add_BtnClickHandler:^(NSInteger tag) {//提交
        [weakSelf subimtData];
        
    }];
    _textView.placeholder = @"请输入您要咨询的内容";
}
- (void)subimtData
{
    if (kStringIsEmpty(_phoneField.text)) {
        [JMNotifyView showNotify:@"请输入手机号" isSuccessful:NO];;
        return;
    }
    if (kStringIsEmpty(_qqField.text)) {
        [JMNotifyView showNotify:@"请输入QQ号" isSuccessful:NO];;
        return;
    }
    if (kStringIsEmpty(_wxField.text)) {
        [JMNotifyView showNotify:@"请输入微信号" isSuccessful:NO];;
        return;
    }
    if (kStringIsEmpty(_textView.text)) {
        [JMNotifyView showNotify:@"请填写反馈内容" isSuccessful:NO];;
        return;
    }
    self.subimtBtn.userInteractionEnabled = NO;
    [self showLoadingAnimation];
    NSMutableDictionary * diccc = [NSMutableDictionary dictionary];
    [diccc setValue:_textView.text forKey:@"content"];
    [diccc setValue:_qqField.text forKey:@"qqNumber"];
    [diccc setValue:_phoneField.text forKey:@"telNumber"];
    [diccc setValue:_wxField.text forKey:@"wxNumber"];
    WeakSelf
    
    NSString  * addCallMe = [[YINetWorkAPIGenerate sharedInstance] APINomark:@"addCallMe"];
    [[SmileHttpTool sharedInstance] POST:addCallMe parameters:diccc origin:NO success:^(NSInteger statusCode, NSString *message, id responseObject) {
        if (statusCode ==0)  {
            [JMNotifyView showNotify:@"提交成功，请耐心等待客服联系您" isSuccessful:NO];
            [weakSelf.navigationController popViewControllerAnimated:YES];
        }else
        {
            [JMNotifyView showNotify:message isSuccessful:NO];;
        }
        weakSelf.subimtBtn.userInteractionEnabled = YES;
        [self stopLoadingAnimation];
        
    } failure:^(id responseObject, NSError *error) {
        weakSelf.subimtBtn.userInteractionEnabled = YES;
        [self stopLoadingAnimation];
    }];
    
}


@end
